/* 
 * File:   peripherals.h
 * Author: NateBond
 *
 * Created on January 17, 2014, 9:39 AM
 */

#ifndef PERIPHERALS_H
#define	PERIPHERALS_H

//#define USE_OR_MASKS
#include <p18Cxxx.h>
#include <plib/delays.h>
#include <plib/adc.h>
#include "thetaServos.h"

/* ---------------------------------------------------------------------------*
 * LED methods                                                                *
 * ---------------------------------------------------------------------------*/
void setGreenOff();
void setGreenOn();
void setRedOff();
void setRedOn();
void setBlueOff();
void setBlueOn();
void setLowBattOff();
void setLowBattOn();

/* ---------------------------------------------------------------------------*
 * Servo methods                                                    *
 * ---------------------------------------------------------------------------*/

#define READ_SPEED 0xff

unsigned char rightServoRun(unsigned char data);
unsigned char rightServoRead();
void rightServoStop();
void rightServoGo();
void rightServoReverse();
void rightServoGoVar();
void rightServoReverseVar();

unsigned char leftServoRun(unsigned char data);
unsigned char leftServoRead();
void leftServoStop();
void leftServoGo();
void leftServoReverse();
void leftServoGoVar();
void leftServoReverseVar();

void bothServosStop();
void bothServosGo();
void bothServosReverse();
void bothServosGoVar();
void bothServosReverseVar();

void spinRight();
void spinLeft();
void turnRight();
void turnLeft();
void spinRightVar();
void spinLeftVar();
void turnRightVar();
void turnLeftVar();

/* ---------------------------------------------------------------------------*
 * Bumper methods                                                             *
 * ---------------------------------------------------------------------------*/
unsigned char getBumpers();

/* ---------------------------------------------------------------------------*
 * SPI methods                                                             *
 * ---------------------------------------------------------------------------*/
unsigned char SPI();

#endif	/* PERIPHERALS_H */